import java.util.Scanner;

public class ArrayNeighbNums {
	
	private static int[] n;
	
	public static void main(String[] args) {
		System.out.println("Please enter the length of array: ");
		readInputFromConsole();
		System.out.println("The index of the first element in the pair with the smalles difference is " + findTheIndexForTheMinDif(n));
	}
	

	
	
	private static void readInputFromConsole() {
		Scanner input = new Scanner(System.in);
		n = new int[input.nextInt()];
		
		System.out.println("Please enter the array elements: ");
		for (int i = 0; i < n.length; i++){
			n[i] = input.nextInt();
		}
	}
	
	private static int findTheIndexForTheMinDif(int[] n){
		int index = 0;
		int minDif = numbersDifference(n, index);
		
		for (int i = 0; i < n.length - 1; i++){
			if (numbersDifference(n, i) < minDif){
				minDif = numbersDifference(n, i);
				index = i;
			}
		}
		return index;
	}
	
	private static int numbersDifference(int[] n, int i){
		return Math.abs(n[i + 1] - n[i]);
	} 
}
